using System.ComponentModel.DataAnnotations;

namespace RestfulApi.Models
{
    /// <summary>
    /// 图书实体模型
    /// </summary>
    public class Book
    {
        /// <summary>
        /// 图书ID，主键
        /// </summary>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 图书标题
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 作者
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string Author { get; set; } = string.Empty;

        /// <summary>
        /// 出版年份
        /// </summary>
        public int PublishYear { get; set; }

        /// <summary>
        /// ISBN编号
        /// </summary>
        [MaxLength(20)]
        public string? ISBN { get; set; }

        /// <summary>
        /// 图书价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 是否可借阅
        /// </summary>
        public bool IsAvailable { get; set; } = true;

        /// <summary>
        /// 图书分类
        /// </summary>
        [MaxLength(30)]
        public string? Category { get; set; }

        /// <summary>
        /// 图书描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }
    }
}